<html>
<head>
<title>管理系统</title>
<meta http-equiv=Content-Type content=text/html;charset=utf-8>
<#include "../inc/commonJs.html">
<script type="text/JavaScript">
	var grid;
	var grid1;
	var grid2;
	$(function() {
		 //分类管理表格  
 		 grid = $('#mydocgrid').datagrid({
         url:'carsqcheck.do?status=100',  
         loadMsg:'数据加载中请稍后……',  
         pagination: true,  
         rownumbers: true,
         pageSize: [${syscfg.pageSize!10}],
         pageList: [${syscfg.pageList!10}],
         striped: true,  
         singleSelect : true,  
         columns:[[  
                   {field:'cph',title: '车牌号',align: 'center',width: '100'},  
                   {field:'userfullname',title: '申请人',align: 'center',width: '250'},
                   {field:'kssj',title: '开始时间',align: 'center',width: '150'},
                   {field:'jssj',title: '结束时间',align: 'center',width: '250'},
                   {field:'fmxmc',title: '状态',align: 'center',width: '250'},
              ]],
             toolbar : '#mydocgridtoolbar'
     });
     
     grid1 = $('#orgdocgrid').datagrid({
		 width: 'auto',  
         height:'auto',             
         striped: true,  
         singleSelect : true,  
         url:'carsqcheck.do?status=101',
         loadMsg:'数据加载中请稍后……',  
         pagination: true,  
         rownumbers: true,
         queryParams: {
			zt: '2'
		 },
		 columns:[[  
                   {field:'cph',title: '车牌号',align: 'center',width: '100'},  
                   {field:'userfullname',title: '申请人',align: 'center',width: '250'},
                   {field:'kssj',title: '开始时间',align: 'center',width: '150'},
                   {field:'jssj',title: '结束时间',align: 'center',width: '250'},
                   {field:'fmxmc',title: '状态',align: 'center',width: '250'},
              ]],
             toolbar : '#orgdocgridtoolbar'
     });  
     grid2 = $('#wpgrid').datagrid({
		 width: 'auto',  
         height:'auto',             
         striped: true,  
         singleSelect : true,  
         url:'carsqcheck.do?status=102',
         loadMsg:'数据加载中请稍后……',  
         pagination: true,  
         rownumbers: true,
         queryParams: {
			zt: '2'
		 },
		 columns:[[  
                   {field:'cph',title: '车牌号',align: 'center',width: '100'},  
                   {field:'userfullname',title: '申请人',align: 'center',width: '250'},
                   {field:'kssj',title: '开始时间',align: 'center',width: '150'},
                   {field:'jssj',title: '结束时间',align: 'center',width: '250'},
                   {field:'fmxmc',title: '状态',align: 'center',width: '250'},
              ]],
             toolbar : '#wpgridtoolbar'
     });  
  })
	function add(gridId) {
		var modalwindow = window.top.modalwindow('${request.contextPath}/xadmin/custom/carsqAdd.do',
			$('#'+gridId),{    
		    width:1100,    
		    height:700,
		    modal:true,
		    resizable:true,
		    title:'车辆使用申请',
		    buttons:[top.btn_save,top.btn_close]   
		});
	};
	
	function edit(gridId) {
		var selected = $('#'+gridId).datagrid('getSelected');
		if(!selected){
			window.top.$.messager.alert('提示',"请选择相关数据进行操作！");
			return;
		}
		var modalwindow =  window.top.modalwindow('${request.contextPath}/xadmin/custom/carsqEdit.do?id='+selected.id,
			$('#'+gridId),{    
		    width:1100,    
		    height:700,
		    modal:true,
		    resizable:true,
		    title:'修改文档信息',
		    buttons:[{
				text:'保存',
				iconCls:"icon-save",
				handler:function(){
					modalwindow.find('iframe').get(0).contentWindow.saveObj(selected.id);
				}
			},{
				text:'关闭',
				iconCls:"icon-cancel",
				handler:function(){
					modalwindow.dialog('close');
				}
			}]   
		});
	};
	
	//工具栏删除
	function del(gridId){
		var selected = $('#'+gridId).datagrid('getSelected');
		if(!selected){
			window.top.$.messager.alert('提示',"请选择相关数据进行操作！");
			return;
		}
		window.top.$.messager.confirm('系统提示', '<br>&nbsp;&nbsp;&nbsp;&nbsp;你确定要删除该信息?', function(r) {
			if (r) {
				$.post("carsqDel.do", { "id": selected.id},
				   function(data){
				   	$('#'+gridId).datagrid('reload'); 
				   	window.top.$.messager.alert('提示',data);
				   	
				});
			}
		});
	}
	function restore(gridId){
		$('#'+gridId+'toolbar input').val('');
		$('#'+gridId).datagrid('reload');
	}
	function dosearch(gridId){
		var params =$('#'+gridId).datagrid('options').queryParams;
		if($('#'+gridId+'name').val()){
			params['cph'] = $('#'+gridId+'name').val();
		}
		$('#'+gridId).datagrid('reload',params);
	}
</script>
</head>
<body>
<div class="easyui-tabs" data-options="fit:true">
	<div title="未批申请">
		<table id="mydocgrid" data-options="fit:true,border:false"></table>
	</div>
	<div title="通过申请">   
       <table id="orgdocgrid" data-options="fit:true,border:false"></table>
    </div>
    <div title="驳回申请">   
       <table id="wpgrid" data-options="fit:true,border:false"></table>
    </div>
</div>   
	<div id="mydocgridtoolbar" style="display: none;">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr >
				<td valign="center">
					&nbsp;&nbsp;车牌号:
					<input  type="text" id="mydocgridname" name="name" maxlength="30" style="width:150px;">
				</td>
				<td valign="center">	
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="dosearch('mydocgrid');">搜索</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="restore('mydocgrid');">重置</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center" align="left">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="add('mydocgrid');">增加</a>
				</td>
			
				<td valign="center" align="left">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" onclick="del('mydocgrid')">删除</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
			</tr>
		</table>
	</div>
	<div id="orgdocgridtoolbar" style="display: none;">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr >
				<td valign="center">
					&nbsp;&nbsp;车牌号:
					<input  type="text" id="orgdocgridname" name="name" maxlength="30" style="width:150px;">
				</td>
				<td valign="center">	
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="dosearch('orgdocgrid');">搜索</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="restore('orgdocgrid');">重置</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
			</tr>
		</table>
	</div>
	<div id="wpgridtoolbar" style="display: none;">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr >
				<td valign="center">
					&nbsp;&nbsp;车牌号:
					<input  type="text" id="wpgridname" name="name" maxlength="30" style="width:150px;">
				</td>
				<td valign="center">	
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="dosearch('wpgrid');">搜索</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="restore('wpgrid');">重置</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
			</tr>
		</table>
	</div>
</body>
</html>